NewTrackMedia
After you have created a new track, you can create a media for the track by calling theNewTrackMedia
function. The media refers to the actual data samples used by the track.
pascal Media NewTrackMedia (Track theTrack, OSType mediaType, TimeScale timeScale, Handle dataRef, OSType dataRefType);
theTrack
- Specifies the track for this operation. Your application obtains this track identifier from such Movie Toolbox functions as
NewMovieTrack
(described on page 2-136).mediaType
- Specifies the type of media to create. The Movie Toolbox uses this value to find the correct media handler for the new media. If the toolbox cannot locate an appropriate media handler, it returns an error. The following types are available:
VideoMediaTyp e
Video media SoundMediaTyp e
Sound media TextMediaTyp e
Text media timeScale
- Defines the media's time coordinate system.
dataRef
- Specifies the data reference. This parameter contains a handle to the information that identifies the file that contains this media's data. The type of information stored in that handle depends upon the value of the
dataRefType
parameter.- If you are creating a new media that refers to existing media data, you can use the
GetMediaDataRef
function (described on page 2-201) to obtain information about the existing data reference. You can then supply information about that reference to this function.- Set this parameter to
nil
to use the file that is associated with the movie or if the movie does not have a movie file. For example, if you have created the movie using theCreateMovieFile
function (described on page 2-84) or theNewMovieFromFile
function (described on page 2-76), the Movie Toolbox assumes that the movie's data resides in the file specified at that time. If you have created the movie using theNewMovieFromScrap
orNewMovie
functions (described on page 2-229 and page 2-80, respectively), the movie does not have a movie file.dataRefType
- Specifies the type of data reference. If the data reference is an alias, you must set this parameter to
rAliasType
('alis'
), indicating that the reference is an alias. See Inside Macintosh: Files for more information about aliases and the Alias Manager.- If you are creating a new media that refers to existing media data, you can use the
GetMediaDataRef
function (described on page 2-201) to obtain information about the existing data reference. You can then supply information about that reference to this function.- Set this parameter to
nil
to use the file that is associated with the movie or if the movie does not have a movie file. For example, if you have created the movie using theCreateMovieFile
function (described on page 2-84) or theNewMovieFromFile
function (described on page 2-76), the Movie Toolbox assumes that the movie's data resides in the file specified at that time. If you have created the movie using theNewMovieFromScrap
orNewMovie
functions (described on page 2-229 and page 2-80, respectively), the movie does not have a movie file.DESCRIPTION
TheNewTrackMedia
function returns a media identifier. If the function cannot create the new media, it sets this returned value tonil
.ERROR CODES
Memory Manager errors
cantFindHandler -2003 Cannot locate a handler cantOpenHandler -2004 Cannot open a handler noMediaHandler -2006 Media has no media handler invalidTrack -2009 This track is corrupted or invalid invalidTime -2015 This time value is invalid